package zl.com;

import java.util.ArrayList;
import java.util.Random;

/**
 * Created with Intellij IDEA.
 * Description:
 * User:张蕾
 * Date:2023-05-30
 * Time:23:30
 */
public class Member extends User{
    public Member() {
    }

    public Member(String name, int money) {
        super(name, money);
    }

    public void receive(ArrayList<Integer> list){
        //随机获取一个集合当中的索引编号
        int index = new Random().nextInt(list.size());
        //根据索引，从集合中删除，并且得到被删除的集合，给我自己
        int delta = list.remove(index);
        //当前成员本来有多少钱
        int money = super.getMoney();
        //加法，并且重新设置回去
        super.setMoney(money + delta);
    }

}
